function Item(/*vec2*/ position, /*Tileset*/ tile, /*ItemFactory*/ item){
	this.position = position;
	this.tile = tile;
	this.item = item;
	this.mapManager = null;
	this.inMap = true;
	this.joker = false;
	
	this.onPlayer = false;
}

Item.prototype.draw = function(){
	if (this.mapManager.getVisible(this.position.a, this.position.b) != 2)
		return;
	var game = this.mapManager.game;
	
	game.drawTile(this.tile, this.position.a - this.mapManager.view.a, this.position.b - this.mapManager.view.b);
};

Item.prototype.step = function(){
	if (this.mapManager.player.position.equals(this.position)){
		if (!this.onPlayer){
			var art = Console.getArticle(this.item.name);
			if (!this.joker)
				Console.addMessage("You stepped on " + art + " " + this.item.name, "aqua", "itemStep");
			this.mapManager.player.addSteppedItem(this, this.id);
			this.onPlayer = true;
		}
	}else{
		this.mapManager.player.removeSteppedItem(this.id);
		this.onPlayer = false;
		this.joker = false;
	}
};

Item.prototype.loop = function(){
	this.step();
	this.draw();
};


